package com.mimi.practice.repository

import android.app.Application
import com.mimi.practice.database.DbManager
import dagger.hilt.android.scopes.ActivityRetainedScoped
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import javax.inject.Inject

@ActivityRetainedScoped
class IndexRepo @Inject constructor(application: Application) {

    private val context = application // 存储 Application 对象

    suspend fun getData() {
        withContext(Dispatchers.IO) {
            DbManager.getDatabase(context).pairDevEntityDao().loadAll()
        }
    }

}